<?php
/* @var $this InstrumentController */
/* @var $model Instrument */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'instrument-form',
	'enableAjaxValidation'=>false,
    'htmlOptions'=>array('enctype'=>'multipart/form-data'),
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'total_stock'); ?>
		<?php echo $form->textField($model,'total_stock'); ?>
		<?php echo $form->error($model,'total_stock'); ?>
	</div>


	<div class="row">
		<?php echo $form->labelEx($model,'model'); ?>
		<?php echo $form->textField($model,'model',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'model'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'specification'); ?>
		<?php echo $form->textField($model,'specification',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'specification'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'price'); ?>
		<?php echo $form->textField($model,'price',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'price'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'manufacturer'); ?>
		<?php echo $form->textField($model,'manufacturer',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'manufacturer'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'brand'); ?>
		<?php echo $form->textField($model,'brand',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'brand'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'production_date'); ?>
		<?php $this->widget('application.extensions.timepicker.EJuiDateTimePicker', array(
            'model'=>$model,
            'language'=>'zh_cn',
            'attribute'=>'production_date',
            'options' => array(
                'dateFormat'=>'yy-mm-dd',
            ),
        ));?>
    
		<?php echo $form->error($model,'production_date'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'purchase_date'); ?>
		<?php $this->widget('application.extensions.timepicker.EJuiDateTimePicker', array(
            'model'=>$model,
            'language'=>'zh_cn',
            'attribute'=>'purchase_date',
            'options' => array(
                'dateFormat'=>'yy-mm-dd',
            ),
        ));?>
		<?php echo $form->error($model,'purchase_date'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'origin'); ?>
		<?php echo $form->textField($model,'origin',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'origin'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'subordinate_units'); ?>
		<?php echo $form->textField($model,'subordinate_units',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'subordinate_units'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'contacts'); ?>
		<?php echo $form->textField($model,'contacts',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'contacts'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'place'); ?>
		<?php echo $form->textField($model,'place',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'place'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description',array('rows'=>6, 'cols'=>50)); ?>
  		<script type="text/javascript">
			var editor = new UE.ui.Editor();
			editor.render("Instrument_description");
		</script>
		<?php echo $form->error($model,'description'); ?>
	</div>

    <div class="form-group">
    <label>图片预览</label>
    <img src="<?php echo yii::app()->baseUrl.'/'.$model->resources->description.$model->resources->fileName;?>" id="imageViewer" width=50% height=350></img>
        <input type="file" id="newsImageView" name="imageFile" style="width:100%;"accept="image/*" onchange="return newsImagePreview()"/>
    </div>

	<div class="row">
		<?php echo $form->labelEx($model,'status'); ?>
		<?php echo $form->textField($model,'status'); ?>
		<?php echo $form->error($model,'status'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->
